//
//  AppDelegate.m
//  xiangzhe
//
//  Created by lyt on 16/11/7.
//  Copyright © 2016年 com.dazhebao. All rights reserved.
//

#import "AppDelegate.h"
#import "YJCTabBarController.h"
#import <MMDrawerController/MMDrawerController.h>
#import "YJCLeftController.h"
#import "YJCDiscoverViewController.h"
#import <UMSocialCore/UMSocialCore.h>

@interface AppDelegate ()

@end

@implementation AppDelegate


- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    
    [[UMSocialManager defaultManager] openLog:YES];
    //设置友盟appkey
    [[UMSocialManager defaultManager] setUmSocialAppkey:@"57b432afe0f55a9832001a0a"];
    // 微博
    [[UMSocialManager defaultManager] setPlaform:UMSocialPlatformType_Sina appKey:@"1809806118"  appSecret:@"3fb7727997af335bc5fe8470300becb3" redirectURL:@"http://sns.whalecloud.com/sina2/callback"];
    // QQ
    [[UMSocialManager defaultManager] setPlaform:UMSocialPlatformType_QQ appKey:@"1105785976"  appSecret:nil redirectURL:@"http://mobile.umeng.com/social"];
    // 微信
    [[UMSocialManager defaultManager] setPlaform:UMSocialPlatformType_WechatSession appKey:@"wx0f27979e152b1948" appSecret:@"0c576e23a1706f3e14b4ac452a2635ac" redirectURL:@"http://mobile.umeng.com/social"];
   //淘宝
//       [[UMSocialManager defaultManager] setPlaform:UMSocialPlatformType_Predefine_Begin appKey:@"23283202"  appSecret:@"1c48a877206ad7bf7ae129cc1950b5af" redirectURL:@"http://mobile.umeng.com/social"];
    // 侧滑
    UIViewController *leftVC = [[YJCLeftController alloc] init];
    
    UIViewController *centerVC = [[YJCTabBarController alloc] init];
    
    MMDrawerController *drawerVC = [[MMDrawerController alloc] initWithCenterViewController:centerVC leftDrawerViewController:leftVC];
    
    [drawerVC setOpenDrawerGestureModeMask:MMOpenDrawerGestureModeAll];
    [drawerVC setCloseDrawerGestureModeMask:MMCloseDrawerGestureModeAll];
    
    [drawerVC setMaximumLeftDrawerWidth:200];
    
    // 初始化窗口
    self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
    
    self.window.rootViewController = drawerVC;
    
    [self.window makeKeyAndVisible];
    
    [UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleLightContent;
    [UIApplication sharedApplication].statusBarHidden = NO;
    
    return YES;
}

// 支持所有iOS系统
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation
{
    BOOL result = [[UMSocialManager defaultManager] handleOpenURL:url];
    if (!result) {
        // 其他如支付等SDK的回调
    }
    NSLog(@"%@",url);
    return result;
}


@end
